package com.ror.java.se.file;

/*
    找到模块的assets/file目录下所有以.txt结尾的文件（需要考虑子文件夹）
 */

import java.io.File;

public class Demo05 {
    public static void main(String[] args) {
        File root = new File("assets", "file");
        findTxt(root);
    }

    static void findTxt(File parent) {
        if (!parent.exists()) return;
        File[] children = parent.listFiles();
        if (children == null) return;
        for (File child : children) {
            if (child.isFile()) {
                if (child.getName().endsWith(".txt")) System.out.println(child);
            } else findTxt(child);
        }
    }
}
